home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload Trio 2
/
Shareware Overload Trio Volume 2 (Chestnut CD-ROM).ISO
/
dir43
/
med300.zip
/
MEPACK.CLA
< prev
next >
Wrap
Text File
|
1994-02-22
|
5KB
|
89 lines
!▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
!█ █
!█ MEPACK.CLA █
!█ Memo field packing/unpacking functions █
!█ █
!█ Revision Number: 1 █
!█ Revision Date : 22-Feb-94 █
!█ █
!█ Revision History █
!█ 1 Created █
!█ █
!▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
MEMBER('MEMOEDIT')
!─────────────────────────────────────────────────────────────────────────
! Local Module Data
!─────────────────────────────────────────────────────────────────────────
qTable QUEUE,PRE(QUE) ! Temp. table for
sLine STRING(255) ! ME_Unpack()
.
!════════════════════════════════════════════════════════════════════════
! Convert current document from Clarion format to packed format
!════════════════════════════════════════════════════════════════════════
ME_Pack PROCEDURE( aMemo, bbKeepFormat )
! Locals:
usLineNo SHORT ! Line index
usMaxLines SHORT ! Max. lines
usDestNdx SHORT ! Dest. index
usLength SHORT ! Line length
CODE
LOOP usMaxLines = MAXIMUM(aMemo, 1) TO 1 BY -1 ! Loop backwards thru memo
IF aMemo[usMaxLines] THEN BREAK. ! Break if not blank
. ! End loop
LOOP usLineNo = 1 TO usMaxLines ! Loop for each memo line
QUE:sLine = aMemo[usLineNo] ! Add to table
ADD(qTable) !
. ! End loop
CMemSet(MED:ulEditBuffer, 20H, MED:usMaxChars) ! Fill memo buffer w/spaces
usDestNdx = 0 ! Set destination index
LOOP usLineNo = 1 TO usMaxLines ! Loop for each memo line
GET(qTable, usLineNo) ! Get saved line
usLength = LEN(CLIP(QUE:sLine)) ! Calc line length
IF VAL(SUB(QUE:sLine, usLength, 1)) <> eHRt ! If last char not HRt
IF NOT OMITTED(2) AND bbKeepFormat ! If retaining format
QUE:sLine = CLIP(QUE:sLine) & CHR(eHRt) ! Append HRt
. ! Endif
usLength += 1 ! For space or HRt
. ! Endif
CMemMove(MED:ulEditBuffer+usDestNdx, ADDRESS(QUE:sLine), usLength)
usDestNdx += usLength ! Update dest. index
. ! End loop
ME_ReformDoc() ! Reformat document
FREE(qTable) ! Free table
RETURN !
!════════════════════════════════════════════════════════════════════════
! Convert current document from packed format to Clarion format
!════════════════════════════════════════════════════════════════════════
ME_Unpack PROCEDURE( aMemo, usWidth )
! Locals:
usLineNo USHORT ! Line number
usLineStart USHORT ! Line start
usLineEnd USHORT ! Line end
CODE
MED:usLineWidth = usWidth ! Reformat to required width
ME_ReformDoc() !
LOOP usLineNo = 1 TO RECORDS( qLine ) ! Loop for each line
usLineStart = ME_LineStart( usLineNo ) ! Retrive line
usLineEnd = ME_LineEnd( usLineNo ) !
ME_GetBlock(QUE:sLine, usLineStart, (usLineEnd-usLineStart)+1)
ADD(qTable) ! Add to temp. table
. ! End loop
CLEAR( aMemo ) ! Clear memo array
LOOP usLineNo = 1 TO RECORDS( qLine ) ! Loop for each line
GET(qTable, usLineNo) ! Get saved line
aMemo[usLineNo] = QUE:sLine ! Assign to memo array
. ! End loop
FREE(qTable) ! Free table
RETURN !